package cn.edu.scau.cmi.wujiaxian.exercise10;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;

public class AnalysisResult {
	
	public static void main(String[] args) {
		File fRead = new File("score.txt");
		File fWrite = new File("scoreAnalysis.txt");
		try {
			Writer out = new FileWriter(fWrite, true);
			BufferedWriter bufferedWriter = new BufferedWriter(out);
			Reader in = new FileReader(fRead);
			BufferedReader bufferedReader = new BufferedReader(in);
			String s = null;
			while ((s = bufferedReader.readLine()) != null) {
				double totalScore = Fenxi.getTotalScore(s);
				s = s + "总分" + totalScore;
				System.out.println(s);
				bufferedWriter.write(s);
				bufferedWriter.newLine();
			}
			bufferedReader.close();
			bufferedWriter.close();
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
}
